Skip to content

Enhancement: sticky session mass delete#294

Open
L1st3r wants to merge 14 commits intoSoju06:mainfrom
L1st3r:feat/sticky_session_mass_delete
Open

Enhancement: sticky session mass delete#294
L1st3r wants to merge 14 commits intoSoju06:mainfrom
L1st3r:feat/sticky_session_mass_delete

Conversation

@L1st3r
Copy link
Copy Markdown
Contributor

@L1st3r L1st3r commented Apr 1, 2026

I realize the functionality was already created, but I felt I could polish it a little bit...

  1. Better backend delete result contract
    Upstream returned only:

    • deletedCount

    This now returns:

    • deletedCount
    • deleted
    • failed with per-row reasons

    Reference:

    • app/modules/sticky_sessions/api.py
    • app/modules/sticky_sessions/service.py
    • app/modules/sticky_sessions/schemas.py
  2. Best-effort partial failure handling
    Upstream bulk delete assumed success as a count.
    This explicitly reports rows that could not be deleted instead of collapsing everything into one number.

  3. Better frontend behavior after bulk delete
    This branch adds:

    • keeping failed rows selected
    • page fallback when deletion empties the current page
    • preserving pagination/filter context more intentionally

    Reference:

    • frontend/src/features/sticky-sessions/components/sticky-sessions-section.tsx
    • frontend/src/features/sticky-sessions/hooks/use-sticky-sessions.ts
  4. More explicit UX wording
    Changed the bulk action from “Remove selected” to “Delete Sessions” and made the confirmation mention failure reporting.

  5. OpenSpec coverage
    Added a proper spec change under:

    • openspec/changes/bulk-delete-sticky-sessions

L1st3r added 3 commits April 1, 2026 14:47
  - add current-page selection controls in the sticky sessions table
  - add a bulk delete action with confirmation dialog
  - preserve filters and pagination after bulk deletion
  - report partial failures for rows that could not be deleted
  - add backend and frontend test coverage for bulk delete behavior
@L1st3r L1st3r requested a review from Soju06 as a code owner April 1, 2026 20:10
@L1st3r
Copy link
Copy Markdown
Contributor Author

L1st3r commented Apr 1, 2026

One note, I could not get any of the tests in tests/unit/test_load_balancer_concurrency.py to actually run. They just hang indefinitely...

@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Apr 2, 2026

@codex review

…ass_delete

# Conflicts:
#	tests/integration/test_http_responses_bridge.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c64e56b29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if target in seen:
continue
seen.add(target)
removed = await self._repository.delete(key, kind=kind)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Batch bulk sticky-session deletes in a single transaction

Calling self._repository.delete(...) inside the per-entry loop turns one bulk request into N separate delete+commit operations (the repository method commits on every call), which is a major regression for requests near the 500-item API limit. This increases latency and makes failures mid-loop leave partially applied deletes with no complete result payload, unlike the previous batched behavior. Please keep the bulk path transactional/batched and compute deleted/failed from that batched outcome.

Useful? React with 👍 / 👎.

Comment on lines +519 to +520
const deleted = payload.sessions.filter((session) =>
targets.has(`${session.kind}:${session.key}`),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report only truly deleted sessions in MSW bulk-delete response

The mock deleted list is built from payload.sessions filtered by targets, but targets is created from the same payload, so every requested row is reported as deleted even if it was never present in state.stickySessions. This makes mock responses internally inconsistent (deletedCount can be smaller than deleted.length) and hides partial-failure behavior in frontend tests.

Useful? React with 👍 / 👎.

@L1st3r
Copy link
Copy Markdown
Contributor Author

L1st3r commented Apr 2, 2026

I will fix this up shortly!

L1st3r added 4 commits April 1, 2026 22:48
…_mass_delete

# Conflicts:
#	tests/integration/test_http_responses_bridge.py
Restore transactional bulk deletion for sticky sessions and derive deleted/failed entries from the batched result.

Update the frontend MSW handler to report only truly deleted sessions and surface not_found failures for missing rows.
…odex-lb into feat/sticky_session_mass_delete
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa9eadc2df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +108 to +110
if target in seen:
continue
seen.add(target)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve duplicate targets in bulk-delete reporting

The new bulk-delete response is meant to report per-request outcomes, but this deduplication step drops repeated (key, kind) entries before execution. If a client submits duplicates (which the request schema currently allows), the response will under-report what happened by collapsing multiple requested deletions into one result, so consumers cannot reliably reconcile each submitted row (e.g., first delete succeeds, second should be not_found). Either preserve request multiplicity when building outcomes or reject duplicates at validation time.

Useful? React with 👍 / 👎.

L1st3r added 2 commits April 3, 2026 13:05
Restore typed sticky-session delete responses, reject duplicate bulk-delete targets, and align frontend/MSW validation with the backend contract.

Resolve sticky-session UI lint issues, apply required Ruff formatting updates, and refresh the lockfile after syncing against the latest app version.
@L1st3r
Copy link
Copy Markdown
Contributor Author

L1st3r commented Apr 3, 2026

I also saw the enhancement request, so I am implementing that now!

@L1st3r L1st3r marked this pull request as draft April 3, 2026 17:23
L1st3r added 3 commits April 3, 2026 13:50
Add server-backed sticky-session filtering by account and key, expose the new controls in the settings UI, and preserve pagination semantics while filtering.

Add backend and frontend regression coverage for the new list-query behavior, and smooth the filter UX by deferring query updates and keeping previous results visible during refetches.
Add server-backed sticky-session sorting for key, account, and updated order so operators can cluster targets before bulk deletion.

Expose sorting through clickable table headers, keep filters and pagination aligned with sort changes, and add backend/frontend regression coverage for the new list query behavior.
Add filtered sticky-session deletion on top of the new server-backed list query model, including account/key filters and sortable cleanup views.

Expose clickable sort headers, a delete-filtered confirmation flow, and backend/frontend regression coverage so operators can narrow, order, and remove large sticky-session sets without page-by-page selection.
@L1st3r
Copy link
Copy Markdown
Contributor Author

L1st3r commented Apr 3, 2026

Added the sticky-session cleanup follow-up UX on this PR.

What changed:

  • Added server-backed sticky-session filtering by account and key
  • Added sortable sticky-session views via clickable Key / Account / Updated headers
  • Added a filtered bulk-delete action so the current filtered result set can be removed without selecting rows page by page
  • Kept the list refresh behavior aligned with active filters/sort/pagination
  • Added backend and frontend regression coverage for filters, sorting, and filtered deletion

Validated locally with:

  • pytest: tests/integration/test_sticky_sessions_api.py
  • vitest: sticky-session hook/component/mock coverage
  • frontend lint
  • ruff + ty

@L1st3r L1st3r marked this pull request as ready for review April 3, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants